const url = require('url');

const getUrlQuery = (urlPath, key = '') => {
  const query = url.parse(urlPath, true).query;
  if (key) {
    return query[key];
  } else {
    return query;
  }
};

module.exports = getUrlQuery;
